package com.mingtai.design.pattern.behavioralming.state;

/**
 * @description:
 * @author: mingtai
 * @createDate: 0:28 2021/1/11
 * @version: 1.0
 */

public class PlayState extends CourseVideoState {

    @Override
    public void play() {
        System.out.println("正常播放视频的状态");
    }

    /**
     * 在play状态下,状态可以切换为:快进speed 暂停pause 停止stop
     *
     */

    @Override
    public void speed() {
        // 快进的时候,只需要调用PlayState的父类CourseVideoState里面的上下文CourseVideoContext,把上下文里面的的状态设置成快进状态
        super.courseVideoContext.setCourseVideoState(CourseVideoContext.SPEED_STATE);
    }



    @Override
    public void pause() {
        super.courseVideoContext.setCourseVideoState(CourseVideoContext.PAUSE_STATE);
    }

    @Override
    public void stop() {
        super.courseVideoContext.setCourseVideoState(CourseVideoContext.STOP_STATE);
    }
}



